package com.first.system.controller;

import com.first.common.pojo.TbZone;
import com.first.common.vo.Result;
import com.first.system.service.ZoneService;
import com.first.system.vo.ZoneVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: first-project
 * @description:
 * @author: 闫锦超
 * @create: 2023-05-26 16:03
 **/
@RestController
@RequestMapping("/home/zone")
@Api(tags = "专区管理")
public class ZoneController {
    @Autowired
    private ZoneService zoneService;
    @PostMapping("getAllZone/{currentPage}/{pageSize}")
    @ApiOperation(value = "获取所有的专区信息")
    public Result getAllZone(@PathVariable Integer currentPage, @PathVariable Integer pageSize, @RequestBody ZoneVo zoneVo){
            return zoneService.getAllZone(currentPage,pageSize,zoneVo);
    }

    @PostMapping("addZone")
    @ApiOperation(value = "添加专区")
    public Result addZone(@RequestBody TbZone tbZone){
       return zoneService.addZone(tbZone);
    }

    @PostMapping("deleteZone")
    @ApiOperation(value = "删除专区")
    public Result deleteZone(@RequestBody TbZone tbZone){
        return zoneService.deleteZone(tbZone);
    }

    @PostMapping("changeStatus/{id}/{isDisable}")
    @ApiOperation("修改专区状态")
    public Result changeStatus(@PathVariable String id,@PathVariable Integer isDisable){
        return zoneService.changeStatus(id,isDisable);
    }
}
